package cn.stevenyang.services;

import org.apache.velocity.tools.generic.MathTool;

public class LogicService {
    private final MathTool mathTool = new MathTool();
    public Object and(Object x, Object y) {
        return (Boolean) x && (Boolean) y;
    }
    public Object or(Object x, Object y) {
        return (Boolean)x || (Boolean)y;
    }
    public Object not(Object x) {
        return !(Boolean)x;
    }
    public Object bitAnd(Object x, Object y) {
        return mathTool.bitwiseAnd(x, y);
    }
    public Object bitOr(Object x, Object y) {
        return mathTool.bitwiseOr(x, y);
    }
    public Object xor(Object x, Object y) {
        return mathTool.bitwiseXOr(x, y);
    }
}
